package com.yiming.shiro.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.util.Collections;

@Configuration
public class SwaggerConfiguration {

    private static final String SWAGGER_TITLE = "Shiro demo";
    private static final String SWAGGER_APP_DESCRIPTION = "Authentication control";
    private static final String SWAGGER_APP_VERSION = "0.1";

    @Bean
    public Docket customDocket () {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfo(
                        SWAGGER_TITLE,
                        SWAGGER_APP_DESCRIPTION,
                        SWAGGER_APP_VERSION,
                        null,
                        null,
                        null,
                        null,
                        Collections.EMPTY_LIST))
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.yiming.shiro.controller"))
                .paths(PathSelectors.any())
                .build();
    }
}
